package com.cbts.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
 * Department entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "department", catalog = "cbts" ,uniqueConstraints = @UniqueConstraint(columnNames = "departmentName"))
public class Department implements java.io.Serializable {

	// Fields

	private String departmentId;
	private String departmentName;
	private Set<UserInfo> userInfos = new HashSet<UserInfo>(0);
	private Set<DepartmentQuarterReport> departmentQuarterReports = new HashSet<DepartmentQuarterReport>(
			0);
	private Set<DepartmentMonthReport> departmentMonthReports = new HashSet<DepartmentMonthReport>(
			0);

	// Constructors

	/** default constructor */
	public Department() {
	}

	/** minimal constructor */
	public Department(String departmentId, String departmentName) {
		this.departmentId = departmentId;
		this.departmentName = departmentName;
	}

	/** full constructor */
	public Department(String departmentId, String departmentName,
			Set<UserInfo> userInfos,
			Set<DepartmentQuarterReport> departmentQuarterReports,
			Set<DepartmentMonthReport> departmentMonthReports) {
		this.departmentId = departmentId;
		this.departmentName = departmentName;
		this.userInfos = userInfos;
		this.departmentQuarterReports = departmentQuarterReports;
		this.departmentMonthReports = departmentMonthReports;
	}

	// Property accessors
	@Id
	@Column(name = "departmentId", unique = true, nullable = false, length = 11)
	public String getDepartmentId() {
		return this.departmentId;
	}

	public void setDepartmentId(String departmentId) {
		this.departmentId = departmentId;
	}
	
	@Column(name = "departmentName", unique = true, nullable = false, length = 45)
	public String getDepartmentName() {
		return this.departmentName;
	}

	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "department")
	public Set<UserInfo> getUserInfos() {
		return this.userInfos;
	}

	public void setUserInfos(Set<UserInfo> userInfos) {
		this.userInfos = userInfos;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "department")
	public Set<DepartmentQuarterReport> getDepartmentQuarterReports() {
		return this.departmentQuarterReports;
	}

	public void setDepartmentQuarterReports(
			Set<DepartmentQuarterReport> departmentQuarterReports) {
		this.departmentQuarterReports = departmentQuarterReports;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "department")
	public Set<DepartmentMonthReport> getDepartmentMonthReports() {
		return this.departmentMonthReports;
	}

	public void setDepartmentMonthReports(
			Set<DepartmentMonthReport> departmentMonthReports) {
		this.departmentMonthReports = departmentMonthReports;
	}

}